package com.yic.module.base.framework.datapermission.config;


import com.yic.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import com.yic.module.base.dal.dataobject.center.CenterDO;
import com.yic.module.base.dal.dataobject.erpcentermapping.ErpCenterMappingDO;
import com.yic.module.base.dal.dataobject.factory.FactoryDO;
import com.yic.module.base.dal.dataobject.workshop.WorkshopDO;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 基础数据 模块的数据权限 Configuration
 *
 * @author 芋道源码
 */
@Configuration(proxyBeanMethods = false)
public class BaseDataPermissionConfiguration {

    @Bean
    public DeptDataPermissionRuleCustomizer baseDeptDataPermissionRuleCustomizer() {
        return rule -> {
            // 工厂表
            rule.addFactoryColumn(FactoryDO.class, "id");
            // 生产车间
            rule.addFactoryColumn(WorkshopDO.class);
            // 工作中心
            rule.addFactoryColumn(CenterDO.class);
            // ERP工作中心映射关系
            rule.addFactoryColumn(ErpCenterMappingDO.class);
        };
    }

}
